package com.github.service.impl;

import com.github.bean.AdminUser;
import com.github.mapper.AdminUserMapper;
import com.github.service.AdminUserServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminUserServerImpl implements AdminUserServer {
    @Autowired
    private AdminUserMapper adminUserMapper;

    @Override
    public boolean login(String account, String password) {
        AdminUser admin = adminUserMapper.getAdminUser(account);
        return admin != null && admin.getPassword().equals(password);
    }

    @Override
    public void logout(String account) {

    }

    @Override
    public boolean addAdminUser(String username, String password) {
        return adminUserMapper.addAdminUser(username, password);
    }

    @Override
    public boolean delAdminUser(String account) {
        return adminUserMapper.delAdminUser(account);
    }

    @Override
    public List<AdminUser> getAllAdminUsers() {
        return adminUserMapper.getAllAdminUsers();
    }
}
